package com.itheima.mapper;

import com.itheima.pojo.Member;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.Date;

@Mapper
public interface MemberMapper {

    //根据身份证号查询会员信息
    @Select("select * from member where id_card = #{idCard}")
    public Member findByIdCard(String idCard);

    //根据手机号查询会员信息
    @Select("select * from member where phone_number = #{telephone}")
    public Member findByTelephone(String telephone);

    void insert(Member member);

    @Select("select count(id) from member where reg_time between #{firstDay} and #{lastDay}")
    Integer getNewMember(Date firstDay, Date lastDay);

    @Select("select count(id) from member")
    Integer getTotalMember();

    @Select("select count(id) from member where reg_time = #{date}")
    Integer getTotalNewMember(Date date);
}
